package com.amit.hibernate;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

public class Client2 {

	public static void main(String[] args) {
		
		SessionFactory sessionfactory=ChibernateUtil.getfactory();
		Session session=sessionfactory.openSession();
		Transaction tx=session.beginTransaction();
		
		CreditCard cc1=new CreditCard(111,"Visa",9999,new Date());
		session.save(cc1);
		
		SilverCustomer c1=new SilverCustomer("amit","amit@gmail.com",1234,"Blore",10,"anil@gmail.com");
		
		c1.setCcard(cc1);
		session.save(c1);
		
		Map<String, String> refs=new HashMap<String, String>();
		refs.put("AA", "11");
		refs.put("BB", "22");
		
		
		CreditCard cc2=new CreditCard(222,"Amex",9999,new Date());
		session.save(cc2);
		
		
		GoldCustomer c2=new GoldCustomer("sd","sd@jlc",123456,refs,100);
		
		c2.setCcard(cc2);
		session.save(c2);
		
		
		
		tx.commit();
		session.close();

	}

}
